package com.bigflexlib.x.RegExp
{
	
	
	import com.bigflexlib.utils.BasicTestBase;
	
	
	public class RegExpUtilTest extends BasicTestBase
	{
		
		
		public function replaceCallBack1( result:* ):String
		{
			return "";
		}
		
		
		public function replaceCallBack2( result:String ):String
		{
			return result.substring( 2 );
		}
		
		
		public function testReplaceWithCallback( ):void
		{
			
			
			var r1:RegExp = / THIS /xg
			var str:String = "Remove THIS";
			
			assertTrue( RegExpUtil.replaceWithCallback( r1, str, replaceCallBack1 ) == "Remove " );
			
			assertTrue( RegExpUtil.replaceWithCallback( r1, str, replaceCallBack2 ) == "Remove IS" );
		
		}

	}
}